<% layout('/layouts/default.html', {title: '渠道结算管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-title">
				<i class="fa icon-notebook"></i> ${text('渠道结算管理')}
			</div>
			<div class="box-tools pull-right">
<!--				<a href="#" class="btn btn-default" id="btnSearch" title="${text('查询')}"><i class="fa fa-filter"></i> ${text('查询')}</a>-->
				<% if(hasPermi('ch:chJiesuan:edit')){ %>
<!--					<a href="${ctx}/ch/chJiesuan/form" class="btn btn-default btnTool" title="${text('新增渠道结算')}"><i class="fa fa-plus"></i> ${text('新增')}</a>-->
				<% } %>
				<a href="#" class="btn btn-default" id="btnSetting" title="${text('设置')}"><i class="fa fa-navicon"></i></a>
			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${chJiesuan}" action="${ctx}/ch/chJiesuan/listData" method="post" class="form-inline hide"
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">

				<div class="form-group">
					<button type="submit" class="btn btn-primary btn-sm"><i class="glyphicon glyphicon-search"></i> ${text('查询')}</button>
					<button type="reset" class="btn btn-default btn-sm isQuick"><i class="glyphicon glyphicon-repeat"></i> ${text('重置')}</button>
				</div>
			</#form:form>
			<table id="dataGrid"></table>
			<div id="dataGridPage"></div>
		</div>
	</div>
</div>
<% } %>
<script >
	var types = JSON.parse(`${types}`);
	var shuilvs = JSON.parse(`${shuilvs}`);
	var statusArr = JSON.parse(`${statusArr}`);
	console.log(statusArr);
</script>
<script>
//# // 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $('#searchForm'),
	columnModel: [
		{header:'${text("媒体名称")}', name:'meitiName', index:'a.alipay_name', width:150, align:"left"},
		{header:'${text("结算编号")}', name:'jiesuanCode', index:'a.jiesuan_code', width:150, align:"left", frozen:true, formatter: function(val, obj, row, act){
			return '<a href="${ctx}/ch/chJiesuan/form?id='+row.id+'" class="btnList" data-title="${text("编辑渠道结算")}">'+(val||row.id)+'</a>';
		}},
		{header:'${text("结算类型")}', name:'jiesuanType', index:'a.jiesuan_type', width:150, align:"center", formatter: function(val, obj, row, act){
			return types[val]; // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("结算金额")}', name:'jiesuanJine', index:'a.jiesuan_jine', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("税率")}', name:'shuilv', index:'a.shuilv', width:150, align:"center", formatter: function(val, obj, row, act){
				return shuilvs[val]; // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
			}},
		{header:'${text("发票附件")}', name:'fapiaoUrl', index:'a.fapiao_url', width:150, align:"center", formatter: function(val, obj, row, act){
				return '<a class="btn btn-info btn-xs blue" target="_blank" href="'+val+'"><i class="fa fa-download"></i> 下载 </a>'; // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
			}},
		{header:'${text("审核状态")}', name:'examineStatus', index:'a.examine_status', width:150, align:"center", formatter: function(val, obj, row, act){
			return statusArr[val]; // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("实际到账金额")}', name:'actualJine', index:'a.actual_jine', width:150, align:"right", formatter: function(val, obj, row, act){
			return js.formatNumber(val, 2, false, ''); // 数值类型格式化 (原始数值, 小数位数, 是否千分位, 默认值，金额情况下设置0.00);
		}},
		{header:'${text("收款人")}', name:'alipayName', index:'a.alipay_name', width:150, align:"left"},
		{header:'${text("支付宝账户")}', name:'alipayCode', index:'a.alipay_code', width:150, align:"left"},
		{header:'${text("公司名称")}', name:'companyName', index:'a.company_name', width:150, align:"left"},
		{header:'${text("开户行")}', name:'bankName', index:'a.bank_name', width:150, align:"left"},
		{header:'${text("银行账户")}', name:'bankCode', index:'a.bank_code', width:150, align:"left"},
		{header:'${text("申请结算日期")}', name:'createTime', index:'a.create_time', width:150, align:"center"},
		{header:'${text("操作")}', name:'actions', width:120, formatter: function(val, obj, row, act){
			var actions = [];
			//# if(hasPermi('ch:chJiesuan:edit')){
				actions.push('<a href="${ctx}/ch/chJiesuan/form?id='+row.id+'" class="btnList" title="${text("结算明细")}">结算明细</a>&nbsp;');
				// actions.push('<a href="${ctx}/ch/chJiesuan/delete?id='+row.id+'" class="btnList" title="${text("删除渠道结算")}" data-confirm="${text("确认要删除该渠道结算吗？")}"><i class="fa fa-trash-o"></i></a>&nbsp;');
			//# }
			return actions.join('');
		}}
	],
	//# // 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});
</script>